package cn.tedu.blog.server.pojo.vo;

import cn.tedu.blog.server.utils.DateUtils;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author 雷茂林
 * @description: 权限资源表
 * @date
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("b_menu")    // 映射表
@ApiModel(value = "Menu对象", description = "系统管理-权限资源表 ")
public class MenuListVO implements Serializable {

    // IdType.AUTO 主键id为空时实现自增
    @ApiModelProperty(value = "权限id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "权限路径名")
    private String name;

    @ApiModelProperty(value = "权限路径")
    private String value;

    @ApiModelProperty(value = "权限描述")
    private String description;

    @ApiModelProperty(value = "父级权限id")
    private Long parentId;

    @ApiModelProperty(value = "深度")
    private Integer depth;

    @ApiModelProperty(value = "是否为父级（是否包含子级），1=是父级，0=不是父级")
    private Integer parent;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "是否启用，1=启用，0=未启用")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = DateUtils.FORMAT_STRING, timezone = "GMT+8")
    private LocalDateTime gmtCreate;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = DateUtils.FORMAT_STRING, timezone = "GMT+8")
    private LocalDateTime gmtModified;

    @TableField(exist = false)
    private String updateTimeStart = null;

    @TableField(exist = false)
    private String updateTimeEnd = null;


    @TableField(exist = false)
    private Integer offset = 0;

    @TableField(exist = false)
    private Integer count = 5;

    /**
     * 如果当前isParent是1，则需要下级分类
     */
    private List<MenuListVO> childrens;
}
